home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / modules / preview_nofade.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2004-06-24  |  2.4 KB  |  98 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    var _loc3_ = extrapath;
  4.    if(_loc3_ == null)
  5.    {
  6.       _loc3_ = "";
  7.    }
  8.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  9.    var _loc1_ = node.firstChild.nodeValue;
  10.    var _loc2_ = node.attributes.path;
  11.    if(_loc2_ != null)
  12.    {
  13.       _loc1_ = _loc2_ + _loc1_;
  14.    }
  15.    else
  16.    {
  17.       _loc1_ = strDefaultPath + _loc3_ + _loc1_;
  18.    }
  19.    if(strPathPrefix == null)
  20.    {
  21.       strPathPrefix = "";
  22.    }
  23.    mc.loadMovie(strPathPrefix + _loc1_);
  24. }
  25. function init()
  26. {
  27.    nmCurrentImage = 0;
  28.    PREVIEW_PATH = nodeData.attributes.imagepath;
  29.    var _loc2_ = undefined;
  30.    var _loc3_ = undefined;
  31.    var strFile;
  32.    len = nmImagesTotal = nodeData.childNodes.length;
  33.    var _loc1_ = 0;
  34.    while(_loc1_ < len)
  35.    {
  36.       _loc2_ = this.createEmptyMovieClip("mc_image_" + _loc1_,++depth);
  37.       _loc2_._visible = false;
  38.       _loc3_ = _loc2_.createEmptyMovieClip("mc_file",++depth);
  39.       strFile = nodeData.childNodes[_loc1_].byName("image").getText();
  40.       _loc3_.onLoad = fileLoaded;
  41.       loadImage(_loc3_,nodeData.childNodes[_loc1_].byName("image"),PREVIEW_PATH);
  42.       _loc1_ = _loc1_ + 1;
  43.    }
  44.    _loc2_ = this.createEmptyMovieClip("mc_image_" + len,++depth);
  45.    _loc2_._visible = false;
  46.    _loc3_ = _loc2_.createEmptyMovieClip("mc_file",++depth);
  47.    _loc3_.onLoad = fileLoaded;
  48.    nmCurrentImage = len;
  49.    loadImage(_loc3_,_parent.ndDefault.byName("image"),PREVIEW_PATH);
  50. }
  51. function exit()
  52. {
  53.    delete mc_front;
  54.    delete mc_back;
  55.    this.removeAllMovieClips();
  56. }
  57. function doOver(num)
  58. {
  59.    default_image = this["mc_image_" + len];
  60.    default_image._visible = false;
  61.    showCurrentImage(num);
  62. }
  63. function doOut()
  64. {
  65.    mc_image = this["mc_image_" + len];
  66.    mc_image._visible = true;
  67.    current_image = this["mc_image_" + nmCurrentImage];
  68.    current_image._visible = false;
  69. }
  70. function showCurrentImage(nextnum)
  71. {
  72.    nmCurrentImage = nextnum;
  73.    mc_back = this["mc_image_" + nmCurrentImage];
  74.    mc_back._visible = true;
  75. }
  76. function fileLoaded()
  77. {
  78.    this.onLoad = null;
  79.    nmImagesLoaded++;
  80.    if(nmImagesLoaded == nmImagesTotal)
  81.    {
  82.       allImagesLoaded();
  83.    }
  84. }
  85. function allImagesLoaded()
  86. {
  87.    this["mc_image_" + len]._visible = true;
  88.    onComplete();
  89. }
  90. nmImagesLoaded = 0;
  91. depth = 0;
  92. this.onReady();
  93. this.onUnload = function()
  94. {
  95.    clearFadeDelay();
  96.    mc_front.onEnterFrame = null;
  97. };
  98.